package com.apes.fn.business.fixedLoss.modle;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.framework.util.DateUtil;
import com.apes.scm.masterdata.frame.model.Dept;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * @ClassName FixedLossLimitPerMonth
 * @Author wsj
 * @Date 2021/5/7 18:15
 * @description 定损额度每月变化明细表
 */


@Entity
@Table(name = FixedLossLimitPerMonth.CONST_TABLE_NAME )
@SelectBeforeUpdate
@Getter
@Setter
@DynamicInsert
@DynamicUpdate
@EntityListeners(DefaultPersistListener.class)
public class FixedLossLimitPerMonth extends BaseModel {
    public final static String CONST_TABLE_NAME = "Fixed_Loss_Limit_Per_Month";

    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "定损额度月明细", padding = 5)
    @Comment("明细编码")
    private  String id;


    @JSONField(format = DateUtil.SHOW_MONTH_FORMAT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "statistic_Date")
    @Comment("统计日期")
    private Date statisticDate;
//
//    @Column(name = "year_month")
//    @Comment("年月")
//    private int yearMonth;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "dept_id", referencedColumnName = "id")
    @Comment("门店")
    private Dept dept;

    @Column(name = "insurance_Amount", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("本月车险金额")
    private double insuranceAmount = 0;

    @Column(name = "convert_Quota", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("车险换算定损额度")
    private double convertQuota = 0;

    @Column(name = "additional_Quota", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("额外增加定损额度")
    private double additionalQuota = 0;

    @Column(name = "total_Quota", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("总定损额度")
    private double totalQuota= 0;

    @Column(name = "surplus_quota", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("剩余定损额度")
    private double surplusQuota= 0;

    @Column(name = "last_month_surplus_quota", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("上月剩余定损额度")
    private double lastMonthSurplusQuota= 0;

    @Column(name = "use_quota", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("使用定损额度")
    private double useQuota= 0;

    @Column(name = "expired_quota", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("当月过期额度")
    private double expiredQuota= 0;

    @Column(name = "make_up_fee", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("需补还定损管理费")
    private double makeUpFee= 0;

    @Column(name = "pay_Premium", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("需补还保费")
    private double payPremium= 0;

}
